<template>
    <base-breadcrumb>
        <template>
            <a-card class="mb20">
                <titleName title="信息详情"></titleName>
                <a-form-model
                    :model="form"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
                    :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }"
                >
                    <a-row :gutter="24">
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="所属分公司">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="所属项目">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="设备编号">
                                <BaseInput disabled v-model="form.equipCode"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="设备名称">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="规格型号">
                                <BaseInput disabled v-model="form.specModel"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="租赁单位">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="installUnit">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="生产厂家">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="合格证号">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="进场日期">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="备案编号">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="检测报告编号">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="出场日期">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="验收情况">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="责任人">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="状态">
                                <BaseInput disabled v-model="form.name"></BaseInput>
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                </a-form-model>
            </a-card>
            <a-card class="mb20">
                <titleName title="相关资料"></titleName>

                <a-table :pagination="false" bordered :columns="columns" :data-source="form.fileInfoList">
                    <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>

                    <span slot="action" slot-scope="text, record">
                        <a
                            :href="
                                '/api/ycloud-file-center/oper/download?access_token=' +
                                token +
                                '&fileId=' +
                                record.fileId
                            "
                            >导出</a
                        >
                        <a-divider type="vertical" />
                        <!-- <a @click="delItem(index)">删除</a> -->
                    </span>
                </a-table>
            </a-card>
            <a-card class="mb20">
                <titleName title="维修保养记录表"></titleName>

                <a-table :pagination="false" bordered :columns="maintenanceRecord" :data-source="data">
                    <span slot="fileList" slot-scope="text, record">
                        <a v-for="i in record.fileList" :key="i.id">{{ record.fileList.fileName }}</a>
                    </span>
                </a-table>
            </a-card>
        </template>
    </base-breadcrumb>
</template>
<script>
import { getEquipmentDetail } from '@/api/safetySupervision/equipmentManagement'
import Vue from 'vue'
const columns = [
    {
        title: '序号',
        dataIndex: 'serial',
        width: '5%',
        scopedSlots: { customRender: 'serial' },
    },
    {
        title: '文件名称',
        dataIndex: 'fileName',
        width: '40%',
    },
    {
        title: '文件格式',
        dataIndex: 'fileFormat',
    },
    {
        title: '操作',
        dataIndex: 'action',
        width: '10%',
        scopedSlots: { customRender: 'action' },
    },
]
const maintenanceRecord = [
    {
        title: '日期',
        dataIndex: 'maintenanceDate',
    },
    {
        title: '操作类型',
        dataIndex: 'maintenanceName',
    },
    {
        title: '维修/保养内容',
        dataIndex: 'content',
        width: '50%',
    },
    {
        title: '维修/保养人',
        dataIndex: 'employeeName',
    },
    {
        title: '附件',
        dataIndex: 'fileList',
        width: '10%',
        scopedSlots: { customRender: 'fileList' },
    },
]
export default {
    name:'a'+Date.now(),    data() {
        return {
            id: '',
            form: {},
            token: '',
            columns,
            maintenanceRecord,
            data: [
                {
                    fileName: 'xxx',
                    fileFormat: 'xxx格式',
                },
                {
                    fileName: 'xxx',
                    fileFormat: 'xxx格式',
                },
            ],
        }
    },
    mounted() {
        this.token = Vue.getAcloudProvider().getAccessToken()
        this.id = this.$route.query.id
        console.log(this.id)
        this.getEquipmentDetail()
    },
    methods: {
        check() {},
        getEquipmentDetail() {
            let params = {
                id: this.id,
            }
            getEquipmentDetail(params).then((res) => {
                this.form = res.data
                console.log(this.form)
            })
        },
    },
}
</script>
